<?php
/*
Plugin Name: qrCode Generator
Plugin URI:
Description: add a qrcode displaying the permalink to all posts in worpress.
Version: 1.0
Author: Shaun Hare
Author URI: http://shaunhare.co.uk
Options: The size of the qrcode can be set on the options screen
*/


load_plugin_textdomain('wp_qr_code');
add_action('admin_menu', array('getQrCode', 'add_options_submenu'));


class getQrCode{

function add_options_submenu() {
		if (!current_user_can('manage_options'))
			return;


		if (function_exists('add_options_page')) {
			add_options_page('QR code plugin options', 'QR code options', 1,basename(__FILE__), array('getQrCode', 'admin_options_subpanel'));
		}
	}

	function admin_options_subpanel() {
		include_once('options_subpanel.inc');
	}


  function getPermalinkQrCode(){
		global $id;
		$url="http://chart.apis.google.com/chart?chs=";

		$height=get_option("qrCode_height");
		$width=get_option("qrCode_width");
		// set defaults
		if($width=="")
		{
			$width=150;
		}
		if($height=="")
		{
			$height=150;
		}

		$url.=$width."x".$height."&cht=qr&chl=".utf8_encode(apply_filters('the_permalink', get_permalink()));
		$url.="&choe=UTF-8";


		echo "<img class=\"qrcode\" src=\"".$url."\" alt=\"qrcode -containing url of this post\" />";


	}




}

?>
